import java.util.*;
import java.io.*;
public class test {
    public static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    // 牛客 添加字符
    public static void main(String[] args) throws IOException{
        String s1 = in.next();int n1 = s1.length();
        String s2 = in.next();int n2 = s2.length();
        char[] a1 = s1.toCharArray();
        char[] a2 = s2.toCharArray();
        int max = 0;
        for(int i = 0;i <= n2 - n1;i++){
            int sum = 0;
            for(int j = i;j < i + n1 && j < n2;j++){
                if(a1[j - i] == a2[j]){
                    sum++;
                }
                if(sum > max){
                    max = sum;
                }
            }
        }
        System.out.println(n2 - (max + n2 - n1));
    }
    // 牛客 数组变换
    public static void main1(String[] args) throws IOException{
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i < n;i++){
            arr[i] = in.nextInt();
        }
        for(int i = 0;i < n;i++){
            for(int j = i + 1;j < n;j++){
                int num = getN(arr[i],arr[j]);
                if(num == -1 || !getT(num)){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
    public static int getN(int a,int b){
        if(a < b){
            int temp = a;
            a = b;
            b = temp;
        }
        return a % b != 0 ? -1 : a / b;
    }
    public static boolean getT(int a){
        while(a % 2 == 0){
            a /= 2;
        }
        return a == 1;
    }
    // 牛客 装箱问题
    public static void main2(String[] args) throws IOException{
        int V = in.nextInt();
        int n = in.nextInt();
        int[] v = new int[n + 1];
        for(int i = 1;i <= n;i++){
            v[i] = in.nextInt();
        }
        int[] dp = new int[V + 1];
        Arrays.fill(dp,-1);
        dp[0] = 0;
        for(int i = 1;i <= n;i++){
            for(int j = V;j >= 0;j--){
                if(j >= v[i] && dp[j-v[i]] != -1){
                    dp[j] = 0;
                }
            }
        }
        int max = 0;
//System.out.println(Arrays.toString(dp));
        for(int i = V;i >= 0;i--) {
            if (dp[i] == 0) {
                max = i;
                break;
            }
        }
        System.out.println(V - max);
    }
}
class Read{
    StringTokenizer st = new StringTokenizer("");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException{
        while(!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    String nextLine() throws IOException{
        return br.readLine();
    }
    int nextInt() throws IOException{
        return Integer.parseInt(next());
    }
    long nextLong() throws IOException{
        return Long.parseLong(next());
    }
    double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }
}